package vip.minesweeper.model;

public abstract class Square {
	private boolean closed;
	private OpenListener listener;

	public Square(OpenListener listener) {
		this.closed = true;
	}

	public void open() {
		if (this.closed) {
			OpenEvent event = new OpenEvent(this, this.doOpen());
			this.listener.onOpen(event);
			this.closed = false;
		}


	}
	protected abstract OpeningResult doOpen();

	public boolean isClosed() {
		return closed;
	}

}
